import { HttpException } from './http.exception';

// 基础认证异常
export class UnauthorizedException extends HttpException {
  constructor(message: string = '未授权') {
    super(401, message);
  }
}

// 权限校验失败
export class PermissionException extends HttpException {
  constructor(message: string = '权限校验失败') {
    super(403, message);
  }
}

// 用户不存在异常
export class UserNotFoundException extends HttpException {
  constructor(message: string = '用户不存在') {
    super(404, message);
  }
}

// 账号或密码错误
export class InvalidCredentialsException extends HttpException {
  constructor(message: string = '账号或密码错误') {
    super(400, message);
  }
}

// 用户被禁用异常
export class UserDisabledException extends HttpException {
  constructor(message: string = '用户已被禁用') {
    super(403, message);
  }
}

// Token相关异常
export class TokenMissingException extends HttpException {
  constructor(message: string = 'Token缺失') {
    super(401, message);
  }
}

export class TokenInvalidException extends HttpException {
  constructor(message: string = 'Token无效') {
    super(401, message);
  }
}

export class TokenExpiredException extends HttpException {
  constructor(message: string = 'Token已过期') {
    super(401, message);
  }
}

export class RefreshTokenMissingException extends HttpException {
  constructor(message: string = '刷新Token缺失') {
    super(401, message);
  }
}

export class RefreshTokenInvalidException extends HttpException {
  constructor(message: string = '刷新Token无效') {
    super(401, message);
  }
}

export class RefreshTokenExpiredException extends HttpException {
  constructor(message: string = '刷新Token已过期') {
    super(401, message);
  }
}

export class TooManyLoginAttemptsException extends HttpException {
  constructor(message: string = '登录尝试次数过多，请稍后再试') {
    super(429, message);
  }
}

export class AccountLockedException extends HttpException {
  constructor(message: string = '账户已被锁定') {
    super(423, message);
  }
}

export class AccountDisabledException extends HttpException {
  constructor(message: string = '账户已被禁用') {
    super(423, message);
  }
}

// 注册相关异常
export class UserAlreadyExistsException extends HttpException {
  constructor(message: string = '用户已存在') {
    super(409, message);
  }
}

export class EmailAlreadyExistsException extends HttpException {
  constructor(message: string = '邮箱已存在') {
    super(409, message);
  }
}

// 密码相关异常
export class PasswordIncorrectException extends HttpException {
  constructor(message: string = '旧密码错误') {
    super(400, message);
  }
}

export class PasswordResetException extends HttpException {
  constructor(message: string = '新密码不能与旧密码相同') {
    super(400, message);
  }
}

// 系统配置异常
export class SystemConfigurationException extends HttpException {
  constructor(message: string = '系统配置错误') {
    super(500, message);
  }
}
